package yifeng.thread;


/**
 * 验证 时间片结束时不会交出锁
 * @author pengyifeng
 *
 */
public class T2 {
	private static Object lock = new Object();

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println("I'm here!");
				synchronized (lock) {
					System.out.println("I get the lock!");
				}
			}
		}).start();
		synchronized (lock) {
			for (long i = 0; i < Integer.MAX_VALUE; i++) {
			}
		}
	}

}
